name: RadioDroid Instrumented Tests CI

on:
  push:
    branches:
      - '*'
  pull_request:
    branches:
      - master

jobs:
  integration-test:
    runs-on: macOS-10.15
    strategy:
      matrix:
        api: [16, 21, 27, 29]
    steps:
      - uses: actions/checkout@v2.3.4
      - name: Set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8
      - uses: malinskiy/action-android/install-sdk@release/0.1.0
      - name: Instrumented tests
        uses: malinskiy/action-android/emulator-run-cmd@release/0.1.0
        timeout-minutes: 35
        with:
          cmd: ./gradlew connectedFreeDebugAndroidTest
          api: ${{ matrix.api }}
          tag: default
          abi: x86
          disableAnimations: true
          hardwareProfile: Nexus 6
      - name: Save instrumented tests output
        uses: actions/upload-artifact@master
        if: failure()
        with:
          name: instrumented-tests-result
          path: build/reports/tests/instrumentedTests
      - name: Save logcat output
        uses: actions/upload-artifact@master
        if: failure()
        with:
          name: logcat
          path: artifacts/logcat.log
